<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class Api_Model_UserTour
{
	private $user_tour_id;
	private $user_id;
	private $tour_id;
	private $role;
	private $status;
	private $created_time;

	public function __construct($usertour_row = null) {
		if(!is_null($usertour_row) && $usertour_row instanceof Zend_Db_Table_Row) {
			$this->user_tour_id = $usertour_row->user_tour_id;
			$this->user_id = $usertour_row->user_id;
			$this->tour_id = $usertour_row->tour_id;
			$this->role = $usertour_row->role;
			$this->status = $usertour_row->status;
			$this->created_time = $usertour_row->created_time;
		}
	}

	public function __set($name, $value) {
		switch($name) {
			case 'user_tour_id':
				if(!is_null($this->user_tour_id)) {
					throw new Exception('Cannot update travel user tour\'s id');
				}
				break;
			case 'user_id':
				if(!is_null($this->user_id)) {
					throw new Exception('Cannot update travel user\'s id');
				}
				break;
			case 'tour_id':
				if(!is_null($this->tour_id)) {
					throw new Exception('Cannot update tour\'s id');
				}
				break;
			case 'role':
				if(!is_null($this->role)) {
					throw new Exception('Cannot update role');
				}
				break;
			case 'status':
				if(!is_null($this->status)) {
					throw new Exception('Cannot update status');
				}
				break;
			case 'created_time':
				if(!is_null($this->created_time)) {
					throw new Exception('Cannot update created time');
				}
				break;
		}
		$this->$name = $value;
	}

	public function __get($name) {
		return $this->$name;
	}
}
